#include "lighting.h"

Lighting::Lighting() : initial(false), scene(false), player(true)
{
}

Lighting::~Lighting()
{
}

bool Lighting::IsEnabled()
{
  return initial.active || scene.active || player.active;
}

bool Lighting::IsChanged()
{
  return initial.changed || scene.changed || player.changed;
}

void Lighting::SetSceneLight(Point position)
{
  //scene.changed = true;

  scene.position[0] = position.x + scene.x;
  scene.position[1] = 10;
  scene.position[2] = position.z + scene.z;
}

void Lighting::SetPlayerLight(Point position, Direction direction)
{
  //player.changed = true;

  player.position[0] = position.x;
  player.position[1] = .75f;
  player.position[2] = position.z;

  player.direction[0] = 0;
  player.direction[1] = 0;
  player.direction[2] = 0;

  switch (direction) {
  case NORTH:
    player.direction[0] = 1;
    break;
  case EAST:
    player.direction[2] = 1;
    break;
  case SOUTH:
    player.direction[0] = -1;
    break;
  case WEST:
    player.direction[2] = -1;
    break;
  default:
    break;
  }
}

void Lighting::HideOptions()
{
  initial.HideOptions();
  scene.HideOptions();
  player.HideOptions();
}
